package cn.dujc.superkid.adapter;

import android.support.annotation.Nullable;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

import cn.dujc.core.adapter.BaseAdapter;
import cn.dujc.core.adapter.BaseViewHolder;
import cn.dujc.superkid.R;
import cn.dujc.superkid.bean.MyExamineResult;
import cn.dujc.superkid.utils.DateUtil;

public class MyExamAdapter extends BaseAdapter<MyExamineResult.MyExamineEntity> {

    public MyExamAdapter(@Nullable List<MyExamineResult.MyExamineEntity> data) {
        super(data);
        mLayoutResId=R.layout.my_exam_item;
    }

    @Override
    protected void convert(BaseViewHolder helper, MyExamineResult.MyExamineEntity item) {
        helper.setText(R.id.exam_title, "《"+item.getEx_title()+"》");
        helper.setText(R.id.exam_grade, "得分："+item.getScore());
        if (item.getYstime().equals("")){
            helper.setText(R.id.exam_time, "用时  "+"0");
        }else {
            helper.setText(R.id.exam_time, "用时  "+item.getYstime());
        }
        long time = Long.valueOf(item.getKstime()).longValue();
        String date2 = DateUtil.formatData("yyyy-MM-dd HH:mm:ss", time);
        helper.setText(R.id.exam_data, date2);
    }

}
